<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">  
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/H-ui.css" />
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/pantentlist/reset.css" />
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/pantentlist/body.css" />
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/pantentlist/main.css" />
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/pantentlist/pantentlist.css">
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/layer.js"></script>

<title>专利协同服务平台</title>

<style type="text/css">
.logo2{
	margin-left:-40px;
	margin-top: -25px;
}	
label.col-xs-3{
	width:30%;
	font-size:18px;
}
.form-label{
	color:#333;
	font-weight:bold;
}
</style>

</head>
<body>	
	<div id="contain" class="c_contain">
    	<!--<div id="top" class="c_top" style="background:#015AB8;height:124px;">
    		<!-- 标题文字 -->
    		<!--<img alt="logo2"
				src="${pageContext.request.contextPath}/images/index_logo2.png"
				class="logo2">
    	</div> -->
    	<div id="center" class="c_center" >
    		<div class="bd" >
				<div class="main_body">
					<div class="tab_2_list">
						<ul>
							<li class="tab_first on">
								<div class="tab_top_on">
									<c:choose>
										<c:when test="${patent.sfSynergy == 1}">
											<p> &nbsp;修改专利协作申请&nbsp; </p>
										</c:when>
										<c:otherwise>
											<p> &nbsp;提交专利协作申请&nbsp; </p>
										</c:otherwise>
									</c:choose>
								</div>
							</li>
							
						</ul>
					</div>
				   <div class="main_box">
						<div class="panel-body">
							<form action="" method="post" class="form form-horizontal responsive" id="commitform">
								<div class="row cl">
									<label class="form-label col-xs-3">专利名称：</label>
									<div class="formControls col-xs-8">
										<input type="text" class="input-text" placeholder="请输入专利的名称" name="name" id="name" autocomplete="off" value="${patent.name}">
									</div>
								</div>
								<div class="row cl">
									<label class="form-label col-xs-3">是否允许跨校协助：</label>
									<div class="formControls skin-minimal col-xs-5">
										<c:choose>
											<c:when test="${patent.allowCorss == 1}">
												<div class="radio-box">
													<input type="radio" id="allowCorss-1" name="allowCorss" value="1" checked="checked">
													<label for="allowCorss-1">允许</label>
												</div>
												<div class="radio-box">
													<input type="radio" id="allowCorss-2" name="allowCorss" value="0">
													<label for="allowCorss-2">不允许</label>
												</div>
											</c:when>
											<c:when test="${patent.allowCorss == 0}">
												<div class="radio-box">
													<input type="radio" id="allowCorss-1" name="allowCorss" value="1">
													<label for="allowCorss-1">允许</label>
												</div>
												<div class="radio-box">
													<input type="radio" id="allowCorss-2" name="allowCorss" value="0" checked="checked">
													<label for="allowCorss-2">不允许</label>
												</div>
											</c:when>
											<c:otherwise>
												<div class="radio-box">
													<input type="radio" id="allowCorss-1" name="allowCorss" value="1">
													<label for="allowCorss-1">允许</label>
												</div>
												<div class="radio-box">
													<input type="radio" id="allowCorss-2" name="allowCorss" value="0">
													<label for="allowCorss-2">不允许</label>
												</div>
											</c:otherwise> 
										</c:choose>	
									</div>
								</div>
								<div class="row cl">
									<label class="form-label col-xs-3" >所属学科&nbsp;&nbsp;&nbsp;<br>(点击展开)：</label>
									<div class="formControls skin-minimal col-xs-5" id = "subjectDiv" >
										<c:set var="subjectCodes"  value="${fn:split(patent.subjectTypes,',')}"/>
										<c:forEach  items="${subjects}"  var="s"  varStatus="status">
										<a style="font-size: 15px;cursor:pointer;text-decoration:none;" onclick="showDiv('div${status.index}')" >${s.description}</a><br/>
										<div id="div${status.index}" style="display:none;"> 
											<c:forEach items="${s.dicPrimarySubjectp}" var="scode" varStatus="scodeStatus">
												<c:set var="flag" value="0"></c:set>
												<c:forEach items="${subjectCodes}" var="code">
													<c:if test="${scode.typeCode == code}">
														<c:set var="flag" value="1"></c:set>
													</c:if>
												</c:forEach>
												<c:choose>
													<c:when test="${flag == 1}">
														<div class="check-box" style="width: 107%;">
															<input type="checkbox" id="subject-${status.count}" name="subject" value="${scode.typeCode}" checked="checked">
															<label for="subject-${status.count}">${scode.description}</label>
														</div>
													</c:when>
													<c:when test="${flag == 0}">
														<div class="check-box" style="width: 107%;">
															<!--<input type="checkbox" id="subject-${status.count}" name="subject1" value="${s.typeCode}"> 
															<label for="subject-${status.count}">${s.description}</label> -->
															<div id="div">
																<input type="checkbox" id="subject-${scodeStatus.count}" name="subject" value="${scode.typeCode}">
																<label for="subject-${scodeStatus.count}" >${scode.description}</label>
															</div>
														</div>
													</c:when>
												</c:choose>
											</c:forEach>
											</div>
										</c:forEach>
									</div>
								</div>
								<div class="row cl">
									<label class="form-label col-xs-3">专利摘要：</label>
									<div class="formControls col-xs-8">
										<textarea cols="" rows=""  class="textarea" name="abstractInfo" id="abstractInfo"  placeholder="请输入专利的摘要">${patentSynergy.abstractInfo}</textarea>
									</div>
								</div>
								<div class="row cl">
									<div class="col-xs-8 col-xs-offset-3">
										<c:choose>
											<c:when test="${patent.sfSynergy == 1}">
												<input class="btn btn-primary"   onclick="submitForm('updateSynergy.action?patentId=${patent.id}')" type="button" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
											</c:when>
											<c:otherwise>
												<input class="btn btn-primary"   onclick="submitForm('commitSynergy.action?patentId=${patent.id}')" type="button" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
											</c:otherwise>
										</c:choose>
										<input class="btn btn-primary" style="margin-left: 77%;"   onclick="closeLayer()" type="button" value="&nbsp;&nbsp;关闭&nbsp;&nbsp;">
									</div>
								</div>
							</form>
						</div>
					</div>
				</div>
			</div>
    	</div><!-- center-->
    	<div id="floor" class="c_floor">
    	
    	</div><!-- floor-->
    </div>
    <script type="text/javascript">
	function submitForm(url){
		$.ajax({
			url:"${pageContext.request.contextPath}/patentSynergy/"+url, 
	        type:"post",  
	        data:$('#commitform').serialize(),
			dataType:'text',
			success:function(data){
				if(data=="success"){
					layer.msg("专利协作申请书提交成功...");
		   			setTimeout(function() {     //1s后执行 
		   				window.location="${pageContext.request.contextPath}/patent/topatentlist.action?submitSynergy=true";
		   				var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
		   				parent.layer.close(index);  // 关闭layer
		   				window.parent.location.reload();
		   	        },300);
				}
			}
		});
	}
	function showDiv(showDiv){
		var div = document.getElementById(showDiv);
		if(div.style.display!="none")
			div.style.display="none";
		else
			div.style.display="block";
	}
	function closeLayer(){
		var index=parent.layer.getFrameIndex(window.name);
		window.parent.location.reload();
		parent.layer.close(index);
	}
	/*$(document).ready(function(){
		 $("input[name='subject1']").each(function(){
			 $(this).siblings('#div').hide();
			 $(this).click(function () { 
				 $(this).attr("checked",false);
				 if($(this).is(':checked')){
					$(this).siblings('#div').show();
				}
				 else
					 $(this).siblings('#div').hide();
				
			}); 
        });
	})*/
		
</script>
</body>
</html>